package com.lanyun.util;

import cn.org.atool.generator.FileGenerator;
import cn.org.atool.generator.annotation.Table;
import cn.org.atool.generator.annotation.Tables;
import org.junit.Test;

/**
 * @author Huang
 * @date 2022/2/9
 */
public class Generator {
    public static final String url = "jdbc:mysql://localhost:3306/tourist?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai";

    @Test
    public void generate() throws Exception {

        FileGenerator.build(Empty.class);
    }

    @Tables(
            // 设置数据库连接信息
            url = url, username = "root", password = "root",

            // 设置entity类生成src目录, 相对于 user.dir
            srcDir = "src/main/java",
            // 设置entity类的package值
            basePack = "com.lanyun",
            // 设置dao接口和实现的src目录, 相对于 user.dir
            daoDir = "src/main/java",
            gmtCreated = "create_time", gmtModified = "update_time", logicDeleted = "is_deleted",
            // 设置哪些表要生成Entity文件
            tables = {@Table(value = {"routes"})}
    )
    static class Empty {
    }
}
